package redis

var redisOperator *Operator

// var dbConn = config.GetDBConnection()
// var imageMapper = mapper.NewImageMapper(dbConn)
// var containerMapper = mapper.NewContainerMapper(dbConn)
var keyMap = map[string]string{
	"RowImageListKey":     "row_image_list",
	"UsedHostPortListKey": "used_host_port_list",
	"AvailableGpuIds":     "available_gpu_ids",
}

func GetAvailableGpuIdsKey() string { return keyMap["AvailableGpuIds"] }
func GetRowImageListKey() string {
	return keyMap["RowImageListKey"]
}

func GetUsedHostPortListKey() string {
	return keyMap["UsedHostPortListKey"]
}

func GetRedisOperator() *Operator {
	return redisOperator
}

//func init() {
//	redisOperator = NewOperator()
//	//rowList, err := imageMapper.ListRowImage()
//	if err != nil {
//		logger.Default.Errorf("Get Row Image List from DB failed: %v", err)
//	}
//	if err := redisOperator.ResetStrKV(GetRowImageListKey(), rowList); err != nil {
//		logger.Default.Errorf("Set Row Image List to Redis failed: %v", err)
//	}
//
//	usedHostPortList, err := containerMapper.ListHostPortMappings()
//	if err != nil {
//		logger.Default.Errorf("Get Used Host Port List from DB failed: %v", err)
//	}
//	if err := redisOperator.ResetStrKV(GetUsedHostPortListKey(), usedHostPortList); err != nil {
//		logger.Default.Errorf("Init Used Host Port List to Redis failed: %v", err)
//	}
//
//}
